package com.service;

import com.dao.ProjectsDao;
import com.entity.Projects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 项目service  // 类说明，在创建类时要填写
 * @ClassName: ProjectSelect    // 类名，会自动填充
 * @Author: weisn          // 创建者
 * @Date: 2020/12/11 8:43   // 时间
 * @Version: 1.0     // 版本
 */

@Service
public class ProjectService {

    @Autowired
    private ProjectsDao projectsDao;


    /**
     * 查询
     * @return
     */
    public List<Projects> getList(int page,int size){return projectsDao.selectList(size*(page-1),size);}

    /**
     * 添加
     * @param projects
     * @return
     */
    public boolean add(Projects projects){
        return projectsDao.ProjectInsert(projects);
    }

    /**
     * 删除项目
     */
    public boolean delete(int id){return projectsDao.projectUpdate(id);}

    /**
     * 修改
     */
    public boolean update(Projects projects){
        return projectsDao.update(projects);
    }

    /**
     * 重置自增
     * @return
     */
    public boolean alter(){return projectsDao.alter();}

    /**
     * 查看id
     */
    public Projects getId(int id){return projectsDao.selectId(id);}

    /**
     * 获取总数
     */
    public int getCount(){
        return projectsDao.selectCount();
    }

}

